<!--
 * @Author: wangzm
 * @Date: 2020-01-09 14:12:03
 * @LastEditors: wangzm
 * @LastEditTime: 2020-02-27 09:49:42
 * @Description: 商品列表
 -->
<template>
  <view class="goods-list" :class="className+'-list'">
    <goods-item v-for="(item, index) in list" :key="index" :class-name="className+'-item'" :goods-data="item" :goods-status="forSale ? 7 : item.status" @click="handleClick"></goods-item>
  </view>
</template>
<script>
import goodsItem from '@/components/goodsItem/index.vue'
export default {
  name: 'GoodsList',
  components: {
    goodsItem
  },
  props: {
    className: {
      type: String, // 自定义样式类
      default: ''
    },
    list: {
      type: Array, // 商品列表数据
      default() {
        return []
      }
    },
    forSale: {
      type: Boolean,
      default: false // 是否待售
    },
    listState: {
      type: Object, // 商品列表状态
      default() {
        return {
          loading: false, // 加载状态
          more: true // 是否还有更多状态
        }
      }
    },
    state: {
      type: Boolean, // 是否显示商品列表加载状态
      default: false
    }
  },
  methods: {
    handleClick(data) {
      this.$emit('itemClick', data)
    }
  }
}
</script>
<style lang="scss">

</style>
